package org.hackystat.devcathlon.ui.page.scoreboard.scorespanel;

import static org.junit.Assert.assertNotNull;
import org.apache.wicket.util.tester.FormTester;
import org.apache.wicket.util.tester.WicketTester;
import org.hackystat.devcathlon.configuration.ConfigurationException;
import org.hackystat.devcathlon.engine.test.DevcathlonTestHelper;
import org.hackystat.devcathlon.ui.DevcathlonApplication;
import org.hackystat.devcathlon.ui.page.login.LoginPage;
import org.junit.Ignore;
import org.junit.Test;

/**
 * Test the scores panel.
 * 
 * @author Daniel Arakaki
 */
public class TestScoresPanel extends DevcathlonTestHelper {
  
  /**
   * Testing the ScorePanel.
   * 
   * @throws ConfigurationException If problem with configuration.
   */
  @Ignore
  @Test
  public void testScorePanel() throws ConfigurationException {
    WicketTester wicketTester = new WicketTester(new DevcathlonApplication());
    
    wicketTester.startPanel(ScoresPanel.class);
    wicketTester.assertRenderedPage(LoginPage.class);
    
    FormTester formTester = wicketTester.newFormTester("loginForm");
    formTester.setValue("user", "admin@hackystat.org");
    formTester.setValue("password", "admin@hackystat.org");
    formTester.submit();
    
    wicketTester.assertRenderedPage(ScoresPanel.class);
    assertNotNull("scores panel should be present...", 
      wicketTester.getTagByWicketId("scores_panel"));
    //wicketTester.startPanel(ScoresPanel.class);
  }
}
